CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

include_directories(${COMN_DIR}/include)
include_directories(${PROJECT_ROOT}/http)
include_directories(${PROJECT_ROOT}/http/jsoncpp-0.10.6/include)

if (WIN32)
    include_directories(${THIRD_PARTY}/stdint)
endif()

link_directories(${PROJECT_ROOT}/lib)
link_directories(${COMN_DIR}/lib)


if (MSVC)
	SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
else()
endif()

aux_source_directory(. SOURCES)
add_executable(DemoDevice ${SOURCES})


target_link_libraries(DemoDevice
	debug comnd optimized comn
	${LIB_PLATFORM}
	debug httpd optimized http
	)

install(TARGETS DemoDevice DESTINATION .)

install(DIRECTORY ${PROJECT_ROOT}/record/ DESTINATION record FILES_MATCHING PATTERN "*.*")



set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
include(InstallRequiredSystemLibraries)

#set(CPACK_PACKAGE_DIRECTORY ${PROJECT_ROOT})
set(CPACK_PACKAGE_NAME "DemoDevice")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DemoDevice app")
set(CPACK_PACKAGE_VENDOR "www.100wits.com")
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)

if(UNIX)
	SET(CPACK_GENERATOR "TGZ")
else()
	SET(CPACK_GENERATOR "ZIP")
endif()

set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/../dist") 
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") 

include(CPack)
